﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using com.google.zxing;

namespace iLikeWine
{
    public partial class qrcode_search : PhoneApplicationPage
    {

        private static string qr_code;

        private static string bb;

        // Constructor
       public qrcode_search()
        {
            InitializeComponent();
        }

       private void Barcode_Click(object sender, RoutedEventArgs e)
        {
            iLike.ScanBarCode.BarCodeManager.StartScan(
                // on success
                (b) => Dispatcher.BeginInvoke(() => 
                    {
                        tbScanResultBarCode.Text = b;
                        bb = b;
                        NavigationService.GoBack();
                    }),
                // on error
                (ex) => Dispatcher.BeginInvoke(() => 
                    {
                        tbScanResultBarCode.Text = ex.Message;
                        NavigationService.GoBack();
                    })
               );
                                         
        }

        private void QrCode_Click(object sender, RoutedEventArgs e)
        {
            iLike.ScanBarCode.BarCodeManager.StartScan(
                // on success
                (b) => Dispatcher.BeginInvoke(() => 
                    {
                        tbScanResultQR.Text = b;
                        bb = b;
                        NavigationService.GoBack();
                    
                       
                    }),
                // on error
                (ex) => Dispatcher.BeginInvoke(() => 
                    {
                        tbScanResultQR.Text = ex.Message;
                        NavigationService.GoBack();
                    }),
                BarcodeFormat.QR_CODE);
        }

        public static string Qr_code
        {
            get { return qr_code; }
            set { qr_code = value; }
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {
            NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
        }

        private void procurar_Click(object sender, RoutedEventArgs e)
        {
            Ver_Qr_Code_Search Qr_code = new Ver_Qr_Code_Search();
            qrcode_search.Qr_code = "bb";//bb;
            NavigationService.Navigate(new Uri("/Ver_Qr_Code_Search.xaml", UriKind.RelativeOrAbsolute));
        }

        

      }
}